/**
 * @param {number} num
 * @return {number}
 */
var addDigits = function (num: number): number {


    if (num === 0) return 0


    const re = num % 9

    return re === 0 ? 9 : re

};


for (let i = 1; i < 100; i++) {

    console.log(i, addDigits(i))
}
